{extend name="base"}
{block name="title"}举报查询{/block}
{block name="head"}
<script src="__STATIC__/common/avalon.mobile-2.2.9.min.js"></script>
{/block}
{block name="body"}
<body class="mainbody">
<form>
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>举报查询</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <div class="menu-list">
          <div class="rule-single-select">
            <select name="channel" style="display:none">
              <option value="-1">===所有渠道===</option>
              {volist name="CHANNELS" id="val"}
              <option value="{$key}"{eq name="channel" value="$key"} selected{/eq}>[{$key}]{$val.Name}</option>
              {/volist}
            </select>
          </div>
            <div class="rule-single-select">
                <select name="isTodo" style="display:none">
                    <option value="-1">===处理状态===</option>
                    {volist name="isTodo" id="val"}
                    <option value="{$key}"{eq name="isto" value="$key"} selected{/eq}>[{$key}]{$val}</option>
                    {/volist}
                </select>
            </div>
          <input type="text" class="input txt" autocomplete="off" name="search1" value="{$search1|default=''|htmlentities}" placeholder="举报人UserID/GameID/昵称" />
          <input type="text" class="input txt" autocomplete="off" name="search2" value="{$search2|default=''|htmlentities}" placeholder="被报人UserID/GameID/昵称" />
          <a class="btn-search"><i class="iconfont icon-search"></i></a>
        </div>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="table-container">
<table>
  <tr>
    <td>
      <table class="ltable border-table">
        <tr>
          <th>#</th>
          <th>所属渠道</th>
          <th>举报人</th>
          <th>被报人</th>
          <th>举报时间</th>
          <th>举报理由</th>
          <th>是否处理</th>
          <th>客服处理回复信息</th>
          <th>操作</th>
        </tr>
      {empty name="list"}
        <tr><td colspan="6">Oh~暂无数据!</td></tr>
      {else/}
        {volist name="list" id="v"}
        <tr data-id="{$v.ID}" data-UserID="{$v.UserID}">
          <td>{$v.ID}</td>
          <td title="{$v.Channel}">{$CHANNELS[$v.Channel]['Name'] ?? '--'}</td>
          <td class="user-avatar">
            <a href="{:url('user.detail/index')}?UserID={$v.UserID}">
              <img src="{$v.Avatar?:'__STATIC__/houtai/images/dface.png'}" />
            </a>
            <div class="user-box">
              <h4><a target="_blank" href="{:url('user.detail/index')}?UserID={$v.UserID}">{:htmlentities($v.NickName)}</a></h4>
              <i>{$v.GameID}</i>
            </div>
          </td>
          <td class="user-avatar">
            <a href="{:url('user.detail/index')}?UserID={$v.UserID2}">
              <img src="{$v.Avatar2?:'__STATIC__/houtai/images/dface.png'}" />
            </a>
            <div class="user-box">
              <h4><a target="_blank" href="{:url('user.detail/index')}?UserID={$v.UserID2}">{:htmlentities($v.NickName2)}</a></h4>
              <i>{$v.GameID2}</i>
            </div>
          </td>
          <td>{$v.CreateTime}</td>
          <td class="jw">{$v.szMessage|trim}</td>
          <td style="color:{switch name='v.isTodo'}{case value='0'}red{/case}{case value='1'}green{/case}{case value='2'}pink{/case}{/switch}">[{$v.isTodo}]{switch name="v.isTodo"}{case value="0"}未处理{/case}{case value="1"}举报成功{/case}{case value="2"}举报失败{/case}{/switch}</td>
          <td>{$v.FeedBackMsg}</td>
          <td>
            {eq name='v.isTodo' value='0'}
            <a class="input" id="upt">处理</a>
            {else}
            <a class="input" id="del">删除</a>
            {/eq}
          </td>
        </tr>
        {/volist}
      {/empty}
      </table>
    </td>
    <td>&nbsp;</td>
  </tr>
</table>

</div>
<!--/列表-->

<!--内容底部-->
<div class="page-footer"><div class="btn-wrap">{$list->render()}</div></div>
<!--/内容底部-->

</form>
<script>
  $.extend({
    SystemMsg: {
      ShowDetailDialog: function (id,UserID) {

        var url = "{:url('repordetail')}?id=" + id+"&UserID="+UserID;
        dialog($.extend({
          title: '举报详情:[' + id + ']<==>用户:['+UserID+']',
          url: url,
          width: 700,
          height: 530,
          okValue: '确认',
          ok: function () {
            var f = $('iframe', this.node);
            var v = $('form', f.contents()).serialize();
            console.log(f);
            console.log(v);
            $.post(url, v, function (resp, state, xhr) {
              console.log(resp);
              alert(resp.error);
              if (resp.errno == 0) {
                location.reload();
              }
            });
            return false;
          }
        }, id > 0 ? {
          button: [{
            value: '取消',
            autofocus: true,
          }]
        } : {})).showModal();
      },
        ShowDeleteConfirm: function (id) {
            dialog({
                title: '提示',
                content: '确定删除?id=' + id,
                width: 200,
                height: 30,
                okValue: '确认',
                ok: function () {
                    var url = "{:url('delete')}?id=" + id;
                    $.post(url, function (resp, state, xhr) {
                        console.log(resp);
                        alert(resp.error);
                        if (resp.errno == 0) {
                            location.reload();
                        }
                    });
                    return false;
                }
            }).showModal();
        },
    }
  });



  $(function () {

    $('table.ltable td:last-child #upt').click(function () {  // 修改
      var id = $(this).parents('tr').attr('data-id');
      var Userid = $(this).parents('tr').attr('data-UserID');
      $.SystemMsg.ShowDetailDialog(id, Userid);
    });
      $('table.ltable td:last-child #del').click(function () {  // 删除

          var id = $(this).parents('tr').attr('data-id');
          $.SystemMsg.ShowDeleteConfirm(id);
      });

  })
</script>
</body>
{/block}